import java.awt.Image;
import intro.ex9.*;

/**
 * This class contains a single static method that is used to create spaceships
 * of the requested type in the game. You should implement it accordingly.
 */
public class SpaceShipFactory {
    
    private static final char HUMAN='h';
    private static final char CRAZY='c';
    private static final char FLOATER='f';
    private static final char runner='r';
    private static final char basher='b';
    private static final char aggressive='a';
    private static final char special='s';
	/**
     * Creates the spaceships in the game according to the passed array of 
     * spaceships names (h,r,f,s,...).
     * See how it is used in SpaceWars.java main method.
     * @param spaceships the command line arguments of SpaceWars 
     * (e.g. spaceships={"h","r","f"}).
     * @return the array of spaceships.
     */
    public static SpaceShip[] createSpaceShips(String[] spaceships) {
        
    	SpaceShip[] ships=new SpaceShip[spaceships.length];
    	for(int i=0;i<spaceships.length;i++){
        	switch (spaceships[i].toCharArray()[0]){
        	case(basher):
        		ships[i]=new Basher();
        		break;
        	case(HUMAN):
        		ships[i]=new Human();
        		break;
        	case(CRAZY):
        		ships[i]=new CrazyHuman();
        		break;
        	case(FLOATER):
        		ships[i]=new Floater();
        		break;
        	case(runner):
        		ships[i]=new Runner();
        		break;
        	case(aggressive):
        		ships[i]=new Aggressive();
        		break;
        	case(special):
        		ships[i]=new Special();
        		break;       
        	}
        	
        }
    	return ships;
    }
}
